<?php
namespace App\Models\Chain\InviteCash;



use App\Constants\CreditLogConstant;
use App\Models\Factory\IdentityCreditFactory;
use App\Models\Factory\InviteFactory;
use App\Models\Chain\AbstractHandler;
use App\Models\Factory\V2\AwUserIntegralFactory;

/**
 * 增加用户积分日志表
 * Class CreateCreditLogAction
 * @package App\Models\Chain\Identity
 */

class CreateIdentityVerifyAction extends AbstractHandler
{
    private $params = array();

    protected $error = array('error' => '插入积分日志失败', 'code' => 7011);


    public function __construct($params)
    {
        $this->params = $params;
    }

    public function handleRequest()
    {
        if ($this->CreateIdentityVerify($this->params) == true) {
            $this->setSuccessor(new CreateCreditLogAction($this->params));
            return $this->getSuccessor()->handleRequest();
        } else {
            return $this->error;
        }
    }


    public function CreateIdentityVerify($params)
    {

        $order_id = AwUserIntegralFactory::createIdentityVerfity($params['user_id']);

        if($order_id)
        {
            $params['order_id'] = $order_id;
            $this -> params = $params;
            return true;
        }

        return false;

    }


}